<template>
  <div>
    <Transition name="fade1">
      <div class="c" v-if="b"></div>
    </Transition>
  </div>
</template>

<script>
import { onMounted, ref } from 'vue'
export default {
  setup () {
    const b = ref(false)
    onMounted(() => {
      setTimeout(() => {
        b.value = true
      }, 4000)
    })
    return { b }
  }
}
</script>

<style scoped lang="less">
.fade1 {
  &-enter {
    &-from {
      opacity: 0;
    }
    &-active {
      transition: all 20s;
    }
    &-to {
    }
  }
}
.c {
  width: 100px;
  height: 100px;
  background-color: red;
  // &:hover {
  //   transition: all 2s;
  //   transform: translateX(20px);
  // }
}
</style>
